package demo523;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

    // 连接数据库
    public class SqlConnection {
        private static final String URL = "jdbc:mysql://localhost:3306/usersDb";
        private static final String USERNAME = "root";
        private static final String PASSWORD = "123456";

        //  实现连接数据库功能（getCon方法）
        public static Connection getCon() throws ClassNotFoundException, SQLException {
            //  1.连接数据库：url(主机号 端口号 数据库名称)  用户名 密码.
            Class.forName("com.mysql.cj.jdbc.Driver");
            return DriverManager.getConnection(URL, USERNAME, PASSWORD);
        }

        public static Connection getConnection() {
            Connection connection = null;
            return connection;
        }
    }

